import requests
import time
import execjs

t = str(int(time.time()*1000))
url = 'https://www.jdl.cn/ecology/getSession?_={}'.format(t)
headers = {
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
}
res = requests.get(url,headers=headers)
print(res.text)
session = res.json()['obj']
print(session)
ct = execjs.compile(open(r"E:/nodeProject/js/jd_yzm.js",encoding='UTF-8').read()).call('data',session)
print(ct)

# getData
# result = execjs.compile(open(r"E:/nodeProject/js/jd_yzm.js",encoding='UTF-8').read()).call('getData',session,ct)
# print(result)
# url = 'https://jcap.m.jd.com/cgi-bin/api/fp?si=%s&ct=%s&version=2&lang=1&client='%(session,ct)
url = 'https://jcap.m.jd.com/cgi-bin/api/fp?si=TPA03QABAAAAAAAAAAAAMJ5z1-EWxnGvFVrHuZWB4DJzhnIhOgJsQUvk7NsFJbsI-TYaM3GYrcYwLIQZSQSzMAAAAAA&ct=TW-00kW0O1VSLWfBpF9I2bIAczPJlprfq1R77HYQfQKYEK1L2lQxkN_3uaJ8U0yR8Q65M0uXFDvnkaN1Prx46-VhPWHJao9ufXlJjZKGRXRLvBb-GwiunvzeAah7Tr_2CK-kqQfcwHxi3LDyNk5skMJC6NtAUEv45PraCv5AUSa5pnLDCI7mZgTxB0JqvM-7Q2rXVSY_1HHE0Wz4EPwsUDUYrxP74lvp5TkyqYq3ZwCC5x5CaOYW71D8IchPxcn-IcYR1zaqX64IBlBXKG1m-vFoHGmiuif1wJ6_Tnc3YmWoesX-3SYotU7xR1HAuKFB0vra8g92z_v1wNQ2cRh25EqzEdqSLhhDAZOx5OBelk-DfFerfbGPI6gLfF6KbYzQQ2CKaDQ4pQxSRSN2HCVQWXI_ZDD-nSMKBP90ntKkLXbW8Agzi-ENpGwseB3_tRIXnjjgDaP_NyGQXK8x21EWP5lUsCeygUyPFieXtJHJOwkK1eV4xHFzLI9GK3yAny4V_ctedmQuW7UhVw3SZfCnoF6ubFV96KPoUqXO8f0coc6m7TISjI8XaZpcr4UaWo2-UOoLA92mgOLyrOok7CwlU6j5hSTmIH903EQhOpf_1wi0BpB6hJiwpk7vEJ8iVqmwIO5ZZ23HEGVoCbqWtsaFQ1bzfse42SnlghKoP2f6U4wVlhiX5BSBH_I7OWp8FNeuMTsyGOVGWNPB3KeO8W99TVM1GZ-UONhOYlaFiE9pYvn1lguvRpgH2eMci_S7yt4qxbunHReIS0swYA_ClaS6VSfv-hXSgHpBUYQqcT11vIwX7HZx1hLpundA0jiYI07ujq2ozwI9PsMRIqGbXW0U-o480mo6P5Q9CpkQe5xHYTBXI21esDKGcZwS_k9zPpmy23G3TYZpk_dRpto-2MO_jNs9dovwulxGCzGPdq_65-NH6UViuUChVJ0vC7ZfdZVjDFP7AqtC6FetCpI001D1f3bqQrOpliEIlIxsCN_5wJ4ven2Sx-w0ak2GcNzKJDEMldcxgq46ptf5SHsvqkanOD8QcH28AY2APFm7NWIyNf3zSvQk8UKtumMhp1F_HYDLOd4hXIwAHgoO6MeqHpgtgybB26ifbi3LgIqMIxou0ixvdrRLwLsgPjzmqYheA1F0CfSHgEdAp8SSO1jqjN28emYuzgOQ_6yXrO8WDuXFNVYeDbHkjufd6N4m_wpgaIL_LOy3RdUFs59bJkwhz_g_KQ&version=2&lang=1&client='
# data = {
#     "si":session,
#     "ct":ct,
#     "version":"2",
#     "lang":"1",
#     "client":""
# }
headers = {
    'authority': 'jcap.m.jd.com',
    'method': 'POST',
    'path': '/cgi-bin/api/fp',
    'scheme': 'https',
    'accept': 'application/json, text/plain, */*',
    'accept-encoding': 'gzip, deflate, br',
    'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
    'cache-control': 'no-cache',
    'content-type': 'application/x-www-form-urlencoded;charset=UTF-8',
    # 'cookie': 'TrackID=1AOoQV0hRXqpw5UZuT1yHAN_zjlg-V9phLoHX6q-_1cd_cf0DPt7sFe8rqCMjaBXUQuIMJAua7OZKP_VTdUDhLNpxXSsGhhWW4QzXGwndQ1I; thor=317DF86A79D04E8215965CA2889DDF81D80BD84BD52113E163E563DD583F746711B8BB41C1E7EF5B61287801D0182A40249ECA97536FF660850EB67EF464936F094983DA656BAF6B1D533760C5AD13F0991892E5CCEFDEBDABF7FA497B52CE744CE7E48915581224CF17BC48C2E19C7AAAF3FEA96359716CBA30221C284F360F; pinId=HmFWFGJN4LdIdSh6p8esqQ; pin=%E5%90%9B%E4%B8%B0%E4%BB%93%E5%BA%93; unick=%E5%90%9B%E4%B8%B0%E4%BB%93%E5%BA%93; ceshi3.com=000; _tp=e10oAB9dBLaSDC0YXNjnjTY0Zu1YFrVkJ0SsFh9xVKP2l8IjeMBOZGQ4B9ljV6kr; logining=1; _pst=%E5%90%9B%E4%B8%B0%E4%BB%93%E5%BA%93',
    'origin': 'https://www.jdl.cn',
    'pragma': 'no-cache',
    'referer': 'https://www.jdl.cn/',
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'cross-site',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36',
}
res = requests.get(url,headers=headers)
print(res.text)

url = 'https://jcap.m.jd.com/cgi-bin/api/check'
